{% extends "main/base.html" %}
{% load i18n %}
{% block title %}{% trans '设备组装详情-采购信息' %}{% endblock %}
{% block content %}
<div class="row">
    <aside class="profile-info col-lg-12">
        <section class="panel">
            <div class="panel-heading">
                <h4 class="heading">{% trans '主设备名称' %}: {{ object.related_equipment_assembly.equipment.equipment_cn|default_if_none:'N/A' }}/{{ object.related_equipment_assembly.equipment.equipment_en|default_if_none:'' }}</h4>
            </div>
            <div class="panel-body bio-graph-info">
                <div class="row">
                    <div class="bio-row">
                        <p><span>{% trans '数量' %}: </span>{{ object.amount }}</p>
                    </div>
                </div>
                <div class="row">
                    <div class="bio-row">
                        <p><span>{% trans '日期' %}: </span>{{ current_date }}</p>
                    </div>
                </div>
                <div class="row">
                    <div class="bio-row">
                        <p><span>{% trans '备注' %}: </span>{{ object.notes }}</p>
                    </div>
                </div>
            </div>
        </section>
        <section class="panel">
            <header class="panel-heading">
                {% trans "部件列表" %}
            </header>
            {% get_current_language as LANGUAGE_CODE %}
            <div class="table-responsive panel-body">
                <table class="table table-striped">
                    <thead>
                        <tr>
                            <th>{% trans '设备' %}ID</th>
                            <th>{% trans '设备中文名' %}/{% trans '设备英文名' %}</th>
                            <th>{% trans '设备类型' %}</th>
                            <th>{% trans '单需' %}</th>
                            <th>{% trans '共需' %}</th>
                            <th>{% trans '库存' %}</th>
                            <th>{% trans '空缺' %}</th>{% if perms.main.view_equipment_basic_price %}
                            <th>{% trans '单价' %}</th>{% endif %}
                            <th>{% trans '备注' %}</th>
                        </tr>
                    </thead>
                    <tbody>{% for d in e_l %}
                        <tr>
                            <td>{{ d.equipment.pk }}</td>
                            <td>{{ d.equipment.equipment_code }}<br>
                                {{ d.equipment.equipment_cn }}<br>
                                {{ d.equipment.equipment_en }}
                            </td>
                            <td>{{ d.equipment.equipment_type }}</td>
                            <td>
                                <label class="btn btn-warning">{{ d.amount_need_single }}</label>
                            </td>
                            <td>
                                <label class="btn btn-success">{{ d.amount_need_all }}</label>
                            </td>
                            <td>
                                <label data-original-title="{% trans '库存信息' %}" data-content="{% for k, v in d.equipment.amount_left.items %}{% if not forloop.first %}{{ k }}: {{ v }}; {% endif %}{% endfor %}" data-placement="bottom" data-trigger="hover" class="btn btn-info popovers">{{ d.equipment.amount_left.total }}</label>
                            </td>
                            <td>
                                <label class="btn btn-danger">{{ d.amount_need_buy }}</label>
                            </td>{% if perms.main.view_equipment_basic_price %}
                            <td>{{ d.equipment.basic_price|default_if_none:'' }}</td>{% endif %}
                            <td>{{ d.notes }}</td>
                        </tr>{% endfor %}
                    </tbody>
                </table>
            </div>
        </section>
    </aside>
</div>
{% endblock %}
{% block footer %}
{% endblock %}